<!--
 * @Author: your name
 * @Date: 2021-04-10 19:37:45
 * @LastEditTime: 2021-05-13 20:13:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \zcz\ws-shop\src\views\Feedback.vue
-->
<template>
  <div class="feedback">
    <van-form @submit="onSubmit">
      <van-field
        autocomplete="off"
        v-model="time"
        name="时间"
        label="发生时间"
        placeholder="如2021.03.05"
        :rules="[{ required: true, message: '请填写发生时间' }]"
      />
      <van-field
        autocomplete="off"
        v-model="text"
        name="事件"
        label="具体事件描述"
        placeholder="请输入文字"
        :rules="[{ required: true, message: '请填写具体事件' }]"
      />
      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit">
          提交
        </van-button>
      </div>
    </van-form>
  </div>
</template>

<script>
import Vue from 'vue'
import { Form, Toast } from 'vant'

Vue.use(Form, Toast)
export default {
  data () {
    return {
      time: '',
      text: ''
    }
  },
  methods: {
    onSubmit () {
      // Toast('已提交，我们会尽快为您解决')
      this.$http.getFeed({
        time: this.time,
        thing: this.text
      }).then(res => {
        if (res) {
          Toast('已提交，我们会尽快为您解决')
          // setTimeout(() => {
          //   this.$router.push({
          //     path: '/login'
          //   })
          // }, 2000)
          this.time = ''
          this.text = ''
        } else {
          Toast('反馈失败，请重试')
        }
      })
    }
  }
}
</script>

<style>

</style>
